home *** CD-ROM | disk | FTP | other *** search
/ Amiga Games: Greatest Hits 1996 / Amiga Games: Greatest Hits 1996.iso / userbox / publicdomain / edspell / rexx / deleteword.epxx < prev    next >
Text File  |  1996-07-28  |  3KB  |  75 lines

  1. /************************************************************************/
  2. /*                                                                      */
  3. /*     File : DeleteWord.epxx                                           */
  4. /*   Author : Martin Reddy                                              */
  5. /*     Date : 28/8/92                                                   */
  6. /*  Purpose : An ARexx script used to control the text editor EdWord    */
  7. /*     Note : This is part of the Spell Checking facility of EdWord     */
  8. /* Function : This script prompts the user for a string and then it     */
  9. /*            will remove all occurrences of that word from the default */
  10. /*            ISpell user dictionary (i.e. EdSpell:Dict/UserDict.txt).  */
  11. /*                                                                      */
  12. /*            If a word is removed from the dictionary, then the curr-  */
  13. /*            ently loaded ISpell dictionary will be removed from RAM   */
  14. /*            so that it must be fetched from disk next time it is      */
  15. /*            requested.                                                */
  16. /*                                                                      */
  17. /************************************************************************/
  18.  
  19.  
  20.     /* Set CONFIRM_DELETION to TRUE if you want the script to get
  21.        confirmation from the user before attempting to delete a word
  22.        from the user dictionary. If you set this to FALSE then you
  23.        will receive no such choice and the word will be immediately
  24.        deleted after you type it in.                                */
  25.         
  26.     CONFIRM_DELETION = TRUE
  27.  
  28.                                       
  29.     /*-------------- Nothing To Change Below Here -----------*/
  30.  
  31.     HOST = ADDRESS()
  32.     ADDRESS VALUE HOST
  33.  
  34.     OPTIONS RESULTS
  35.  
  36.     /**************** Get a Word From The User *****************/
  37.  
  38.     GetInput "Enter Word To Delete From Dictionary :"
  39.     IF RESULT ~= "RESULT" THEN DO
  40.  
  41.         WORD = COMPRESS( UPPER(RESULT), '~`,./<>?;:"[]{}!@#$%^&*()+|=\- ' )
  42.  
  43.         /************* confirm deletion of the word *************/
  44.  
  45.         IF CONFIRM_DELETION == TRUE THEN DO
  46.             CHOICE "Please confirm deletion of "||WORD||"| from your User Dictonary.@@Yes, Delete|No, Cancel"
  47.             IF RC == 0 THEN EXIT
  48.         END
  49.  
  50.         /************* Now try to delete the word *************/
  51.  
  52.         ADDRESS COMMAND 'EdSpell:Utils/DelWord '||WORD
  53.         IF RC == 0 THEN DO
  54.             Inform WORD||" has been removed|from your User Dictonary."
  55.             CALL UnloadDict
  56.         END; ELSE IF RC == 1 THEN DO
  57.             Inform "The word "||WORD||"|is not in your User Dictonary."
  58.         END; ELSE DO
  59.             Inform "A disk error occurred!|Word not removed."
  60.         END;
  61.  
  62.     END
  63.  
  64.     EXIT
  65.  
  66.     
  67.     /************ PROCEDURE: "UnLoadDict" ************/
  68.  
  69.     UnloadDict: PROCEDURE
  70.         IF ~SHOW( PORTS, 'IRexxSpell' ) THEN RETURN
  71.         ADDRESS "IRexxSpell" EXIT
  72.     RETURN
  73.  
  74.  
  75.